add_custom_target(libc_sched_unittests)

add_libc_unittest(
  affinity_test
  SUITE
    libc_sched_unittests
  SRCS
    affinity_test.cpp
  DEPENDS
    libc.hdr.types.cpu_set_t
    libc.hdr.types.pid_t
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
    libc.src.errno.errno
    libc.src.sched.sched_getaffinity
    libc.src.sched.sched_setaffinity
    libc.test.UnitTest.ErrnoCheckingTest
    libc.test.UnitTest.ErrnoSetterMatcher
)

add_libc_unittest(
  yield_test
  SUITE
    libc_sched_unittests
  SRCS
    yield_test.cpp
  DEPENDS
    libc.src.errno.errno
    libc.src.sched.sched_yield
    libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_unittest(
  get_priority_test
  SUITE
    libc_sched_unittests
  SRCS
    get_priority_test.cpp
  DEPENDS
    libc.hdr.sched_macros
    libc.src.errno.errno
    libc.src.sched.sched_get_priority_min
    libc.src.sched.sched_get_priority_max
    libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_unittest(
  getcpu_test
  SUITE
    libc_sched_unittests
  SRCS
    getcpu_test.cpp
  DEPENDS
    libc.src.errno.errno
    libc.src.sched.getcpu
    libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_unittest(
  scheduler_test
  SUITE
    libc_sched_unittests
  SRCS
    param_and_scheduler_test.cpp
  DEPENDS
    libc.hdr.sched_macros
    libc.hdr.types.struct_sched_param
    libc.src.errno.errno
    libc.src.sched.sched_getscheduler
    libc.src.sched.sched_setscheduler
    libc.src.sched.sched_getparam
    libc.src.sched.sched_setparam
    libc.src.sched.sched_get_priority_min
    libc.src.sched.sched_get_priority_max
    libc.src.unistd.getuid
    libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_unittest(
  sched_rr_get_interval_test
  SUITE
    libc_sched_unittests
  SRCS
    sched_rr_get_interval_test.cpp
  DEPENDS
    libc.hdr.sched_macros
    libc.hdr.types.struct_timespec
    libc.src.errno.errno
    libc.src.sched.sched_getscheduler
    libc.src.sched.sched_setscheduler
    libc.src.sched.sched_get_priority_min
    libc.src.sched.sched_rr_get_interval
    libc.src.unistd.getuid
    libc.test.UnitTest.ErrnoCheckingTest
)

add_libc_unittest(
  cpu_count_test
  SUITE
    libc_sched_unittests
  SRCS
    cpu_count_test.cpp
  DEPENDS
    libc.hdr.sched_macros
    libc.hdr.types.cpu_set_t
    libc.hdr.types.pid_t
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
    libc.src.errno.errno
    libc.src.sched.sched_getaffinity
    libc.src.sched.__sched_getcpucount
    libc.test.UnitTest.ErrnoCheckingTest
    libc.test.UnitTest.ErrnoSetterMatcher
)
